'use strict';function _ow(a,b,d="",c="",e=!1){d=`<select name="${d}" ${c}>`;e&&(d+="<option>");for(let [g,h]of a)d+=`<option value="${g}" ${b==g?"selected":""}>${h}`;return d+"</select>"}function _io(a,b,d=""){return`<input type=checkbox ${a?`name="${a}"`:""} ${b?"checked":""} ${d}>`}{let a;var _Ui=function(b,d,c,e=""){!0===b&&(b=a="radioGroup_"+Math.random());b||(b=a);return`<input type=radio name="${b}" value="${d}" ${d==c?"checked":""} ${e}>`}}
function _if(a,b,d="",c=""){return`<input type=text name="${a}" value="${_5h(b||"")}" ${c} placeholder="${d}" style="--len: ${(b||"").length}" spellcheck=false>`}function _bp(a,b,d,c,e,g=""){a=a[b];"function"==typeof a&&(a=a());return`<customSelect options=${b} colSize="${e||""}" name=${d} value="${c}" ${g}><l>${_3y(a[c])[0]}</l></customSelect>`}
function _Qp(a,b,d,c,e=""){a=_Dr(a);return`<customSelect name="${b}" value="${d}" colSize="${c||""}" ${e} options="${_5h(JSON.stringify(a))}">${a.has(d)?_3y(a[d])[0]:"&nbsp;"}</customSelect>`}
function _6o(a){var b=$(a).attr("options"),d=$(a).attr("value");let c=+$(a).attr("colSize");try{var e=JSON.parse(b)}catch(h){}if(!e){var g=$(a).closest("[optionsCollection]").prop("optionsCollection");e=b?g[b]:{[d]:$(a).html()};"function"==typeof e&&(e=e())}b="";g=0;for(let [h,f]of e){f=_3y(f);f[2]&&g&&(b+="<hr>");e=h==d?"selected":"";const k=_xp(h+"")?"custom":"";b+=`<opt value="${h}" ${e} ${k} ${f[3]||""}><l>${f[0]}</l> ${f[1]?`<h h=${f[1]}></h>`:""}</opt>`;++g==c&&(b+="</group><group>")}b=b?`<group>${b}</group>`:
"<empty>No options</empty>";d=$(a).is("[helpCtx]")?`helpCtx="/${_Xi($(a).attr("helpCtx")||$(a).attr("name"),_hk(a)).join("/")}"`:"";return $(`<optionsSelect popupCntr DataModule ${d} ${""}>${b}</optionsSelect>`).on("click","opt",function(){$(this).closest("optionsSelect").triggerEvt("focusLost");$(a).attr("value")!=$(this).attr("value")&&$(a).html($(">l",this)[0].outerHTML).attr("value",$(this).attr("value")).triggerEvt("change",!0)}).on("close",function(){$(this).remove()})}
let _Hy=(()=>{function a(c,e,g){function h(f,k=[]){let l="";for(let m of f.children){if(m.url&&g)continue;f=[];let n=m.children?h(m,f):"";l+=`\n <item key=${m.id} ${m.url||!n?"":`content=${f[0]|0}`} ${m.id==c?"selected":""}>\n <b></b><c>${b(m)}</c>\n </item>\n <children>${n}</children>\n `;if(m.id==c||f[0])k[0]=1}return l}return $(`<bmTree>${h(e)}</bmTree>`).on("click","b",function(f){f.stopImmediatePropagation();f=$(this).closest("item");f.attr("content",+!+f.attr("content"))})}function b(c){return`<img src="${c.url?
_5h(_Tu(c.url)):"/res/folder.png"}"><t>${_5h(c.title)}</t>`}function d(c,e){_Ky.bookmarks.getTree(([g])=>{g=a($(c).attr("value"),g,e).on("click","item > c",function(){$(c).attr("value",$(this).closest("item").attr("key")).html($(this).html()).triggerEvt("change",!0);$(this).triggerEvt("focusLost",!0)});_Jh(g,c,"btlr","tailAndShadowBig noTail");$("item[selected]",g).each(function(){this.scrollIntoViewIfNeeded(!0)})})}return function(c,e,g=!1){let h=$(`<customSelect name=${c} placeholder="Choose a ${g?
"":"bookmark or"} folder..."></customSelect>`);if(!_Ky.bookmarks)return h;_Ky.bookmarks.get(e+"",f=>{!_fy()&&f&&f[0]&&h.attr("value",e).html(b(f[0]))});return h.on("mousedown",function(){d(this,g)})}})();
function _sa(a){var b="";let d=a.value;for(let [c,e]of _hf._h){let g=d[c]||{};b+=`\n <div monId=${c}>\n <cell>${e.name}</cell>\n <cell>\n <input type=number name=cols value="${g.cols||1}" min=1 max=30>\n &times;\n <input type=number name=rows value="${g.rows||1}" min=1 max=30>\n </cell>\n </div>`}b=$(`\n <gridLayoutEditor>\n <monitorList>\n <div><cell></cell><cell><c><l>Cols</l> <l>Rows</l></c></cell></div>\n ${b}\n </monitorList>\n </gridLayoutEditor>\n `).on("input",function(c){c.stopPropagation();
let e=$(c.target).closest("[monId]").attr("monId");_ih(d,e,c.target.name,_pu(c.target),NaN);$(this).removeClass("empty");$(a).triggerEvt("change")});_Pt(d)&&b.addClass("empty");return b}function _eu(a,b,d="",c="",e="",g=""){return $(`<FSPathInput ${e}>${_if(a,b,d,"field "+g)}<button>...</button></FSPathInput>`).on("click","button",_Et(function*(){let h=$(this).prev(),f=h.val();h.is("[locPlhlr]")&&(f=yield _hf._9y(f));let k=yield _Rp(f,c);k&&k!=f&&(h.val(k),h.triggerEvt("input change",!0))}))}
function _4s(a,b,d){let c=document.createElement("A");c.download=a;c.href=d?b:URL.createObjectURL(b instanceof Blob?b:new Blob([b]));c.click();d||setTimeout(()=>URL.revokeObjectURL(c.href),2E3)}function _1a(a){_R("file81.js")(()=>_Cs(a))}function _Ap(a,b,d,c=!1){c&&a.points.clear();c=a.viewportElement.createSVGPoint();c.x=b;c.y=d;a.points.appendItem(c)}
function _oj(){_Wg();$(document).captureEvt("mousedown","customSelect edit",function(a){a.stopPropagation();let b=$(this).closest("customSelect");a="other"==b.attr("value")?()=>_ji.tse.editor(b[0]):()=>_ns(b.attr("value"));_iw(a,this)}).on("mousedown","action > targets edit",function(a){a.stopImmediatePropagation()}).on("mousedown","customSelect[options]",function(){_Jh(_6o(this),this,"btrl")}).captureEvt("change","customSelect",function(a,b){b||("other"==$(this).attr("value")?setTimeout(()=>$("edit",
this).triggerEvt("mousedown",!0),100):delete this.value)}).on("input","input[type=text], [textInput]",_se(200,function(){$(this).triggerEvt("change",!0)})).on("keydown","input[type=text], [textInput]",function(a){13==a.keyCode&&this.blur()}).captureEvt("click dblclick","btn[del], button[delete], del, item[name=delete]",function(a){clearTimeout(this.delMsgTimer);"click"==a.type&&(this.delMsgTimer=setTimeout(()=>{this.helpBubble=_Jh("<help noPopupAround><nobr>Double click to delete</nobr></help>",this,
"rbtl","infoBubble small","","opacity")},250))}).on("click","[initDemo]",function(){_1a($(this).attr("initDemo"))}).on("click","a[href]",function(){if(this.href.endsWith(".exe"))return!0;this.href.startsWith("chrome:")?_Ky.tabs.create({url:this.href}):open(this.href,"_blank");return!1}).on("mousedown","iconPick",function(){_Jh(_yp(this,$(this).attr("use")),this,"btrl","tailOnly noTail")}).on("change","iconPick:not(iconUID)",function(){$(this).attr("img",this.value.img?"":null).css("--img",this.value.img?
`url(${this.value.img})`:"")}).captureEvt("input focus","[autoDim]",function(){$(this).css({width:"20px","flex-grow":0,"min-width":"auto"}).css("width",this.scrollWidth+4).css({"flex-grow":"","min-width":""})}).on("mousedown","customSelect[entityType]",function(){_Jh(_k(this),this,"btrl","borderAndShadowSimple noTail")});$(document.body).captureEvt("click","[perms]",function(a){a.originalEvent.isTrusted&&!$(this).is("input[type=checkbox]:not(:checked)")&&(a.stopPropagation(),a.preventDefault(),_9h($(this).attr("perms"),
"permMsgs/feature")(b=>b&&a.target.click()))})}
let _Na=_Et(function*(a,b,d={},c={}){a=_ne(a).attr(d.attrs||{});c.beforePopup&&(yield c.beforePopup(a));let e,g;if(_Jh(a,b,d.sideOrder||"btrl","noTail"))a.on("mouseenter","item",function(){g=setTimeout(()=>{$(this).is(".popup")||$(this).parent().triggerEvt("mousedown",!0)},300)}).on("mouseenter","item[menu]:not(.popup)",function(h){e=setTimeout(()=>$(this).triggerEvt("click",!0),300)}).on("mouseleave","item",function(){clearTimeout(e);clearTimeout(g)}).on("click dblclick","item",function(h){$(this).is("[menu]")?
$(this).is(".popup")||_Na($(this).attr("menu"),this,{sideOrder:"r<l<"},c.click.call(this,h)):c.click.call(this,h)&&$(this).triggerEvt("close",!0)})});
function _hs(a,b,d,c=!0){let e={tit:"title",url:"url",domn:"domain",mdom:"mainDomain",path:"path",dPth:"dirPath",prot:"url.protocol",qry:"url.query",frag:"url.fragment",sltn:"selection",ombar:"omnibox",obWrd:"omnibox.words",clbrd:"clipboard",exClb1:"clipboard(1)",clbLns:"clipboard.lines",clbWrd:"clipboard.words",date:"date",var:"var.<v>var_name</v>",dir:"dir.<v>dir_name</v>",env:"env.<v>env_name</v>",fname:"fileName",fext:"fileExt",txt:"text",L_prof:"profile",L_desk:"desktop",L_doc:"documents",L_star:"startup",
L_rec:"recent",L_win:"winDir",L_prog:"progFiles",L_prg86:"progFilesX86",L_app:"appData",L_tmp:"temp",L_drv:"systemDrive"};c&&d.push("var");let [g,h]=_3y(a);$(g).on("mousedown","[button]",function(f){let k=h?this.closest(h):g;k&&(f.preventDefault(),f=_Bj(_lo)`\n <templExprMenu popupCntr>\n ${d.map(l=>`<it><c>&lt;${e[l]}&gt;</c> <h h='/actions/tmplExpr/${l}'></h></it>`)}\n </templExprMenu>\n `.on("close",function(){this.remove()}).on("mousedown",l=>{l.target.closest("help")||l.preventDefault()}).on("click",
"it",function(){_xw($("[field]",k)[0],this.innerText.trim());$(this).closest("templExprMenu").triggerEvt("focusLost")}),_Jh(f,$(k).find("[popupAround]").addBack("[popupAround]")[0]||this,b))})};
